<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title>余生请多指教</title>
    <link type="text/css" rel="stylesheet" href="css/default.css">
    <script type="text/javascript" src="js/jquery.min.js"></script>
    <script type="text/javascript" src="js/jscex.min.js"></script>
    <script type="text/javascript" src="js/jscex-parser.js"></script>
    <script type="text/javascript" src="js/jscex-jit.js"></script>
    <script type="text/javascript" src="js/jscex-builderbase.min.js"></script>
    <script type="text/javascript" src="js/jscex-async.min.js"></script>
    <script type="text/javascript" src="js/jscex-async-powerpack.min.js"></script>
    <script type="text/javascript" src="js/functions.js" charset="utf-8"></script>
    <script type="text/javascript" src="js/love.js" charset="utf-8"></script>

    <style type="text/css">
        /*.STYLE1 {
            color: #666666;
        }*/
    </style>
</head>
<body>
<audio autoplay>
    <source src="music/forgive.mp3"/>
</audio>

<div id="main">
    <div id="error">
    </div>
    <div id="wrap">
        <div id="text">
            <div id="code">
                <font color="#FF0000" style="line-height: 30px;">
                    <span class="say">梦茹呀</span><br>
                    <span style="padding-left: 15px" class="say">我喜欢你！</span><br>
                    <span style="padding-left: 15px" class="say">春风十里，五十里，一百里，</span><br>
                    <span style="padding-left: 15px" class="say">体测八百米，海底两万里，</span><br>
                    <span style="padding-left: 15px" class="say">德芙巧克力，香草味八喜，</span><br>
                    <span style="padding-left: 15px" class="say">可可布朗尼，榴莲菠萝蜜，</span><br>
                    <span style="padding-left: 15px" class="say">芝士玉米粒，鸡汁土豆泥，</span><br>
                    <span style="padding-left: 15px" class="say">黑椒牛里脊，黄焖辣子鸡，</span><br>
                    <span style="padding-left: 15px" class="say">红烧排骨酱醋鱼，不如你，全都不如你。</span><br>
                    <span style="padding-left: 15px" class="say">锁屏是你，密码是你，主屏幕是你，</span><br>
                    <span style="padding-left: 15px" class="say">头像是你，键盘是你，聊天背景也是你，</span><br>
                    <span style="padding-left: 15px" class="say">自从遇见了你，就一下子都变成了你。</span><br>
                    <span style="padding-left: 15px" class="say">总而言之，言而总之，我喜欢你，就是喜欢你！</span><br>
                    <span class="say"><span class="space"></span>很喜欢很喜欢你的大宇呀</span>
                    <!--<span style="padding-left: 15px" class="say">亲爱的 我想带着你 ———— </span><br>
                    <span style="padding-left: 15px" class="say">去巴黎给你讲讲卢浮宫每件艺术品背后的精妙思想</span><br>
                    <span style="padding-left: 15px" class="say">去迪拜带你睡一晚阿拉伯塔七星级酒店的大床</span><br>
                    <span style="padding-left: 15px" class="say">去卡帕多奇亚坐坐热气球 在微风的傍晚和你一起翱翔</span><br>
                    <span style="padding-left: 15px" class="say">去南安普顿的沙滩散散步</span><br>
                    <span style="padding-left: 15px" class="say">因为那是杰克和露丝爱情开始的地方</span><br>
                    <span style="padding-left: 15px" class="say">去普罗旺斯坐在满是紫色薰衣草的地面上等待夕阳</span><br>
                    <span style="padding-left: 15px" class="say">去纽约逛逛曼哈顿 看看自由女神像</span><br>
                    <span style="padding-left: 15px" class="say">去冰岛看一看五彩斑斓的极光 许下长相厮守的愿望</span><br>
                    <span style="padding-left: 15px" class="say">还想去你长大的地方</span><br>
                    <span style="padding-left: 15px" class="say">想知道那里夜晚的天空是不是和你的眼睛一样明亮</span><br>
                    <span style="padding-left: 15px" class="say">最后带你去伯利兹蓝洞的潜潜水</span><br>
                    <span style="padding-left: 15px" class="say">因为那里的海水清澈 不惧死亡</span><br>
                    <span class="say"><span class="space"></span>很喜欢很喜欢你的大宇呀</span>-->

                    <!--<span style="padding-left: 15px" class="say">昨晚梦到你啦</span><br>
                    <span style="padding-left: 15px" class="say">我梦见你的头发穿过我的指间</span><br>
                    <span style="padding-left: 15px" class="say">梦见你贯穿了我此生所有的华年</span><br>
                    <span style="padding-left: 15px" class="say">我们骑着单车  一路旅行过 </span><br>
                    <span style="padding-left: 15px" class="say">淡水河边 老旧书院 咖啡馆 小吃店</span><br>
                    <span style="padding-left: 15px" class="say">也陪你荡过秋千 滑稽的荡起那些最好的童年</span><br>
                    <span style="padding-left: 15px" class="say">你说 亲吻这件事不能随便</span><br>
                    <span style="padding-left: 15px" class="say">但你还是让我吻了你的脸</span><br>
                    <span style="padding-left: 15px" class="say">我说 ‘我爱你’ 这三个字是最珍贵的字眼</span><br>
                    <span style="padding-left: 15px" class="say">可你还是逼我 对你说了上千遍</span><br>
                    <span class="say"><span class="space"></span>很喜欢很喜欢你的大宇呀</span>-->


                    <!--

                    <span style="padding-left: 15px" class="say">如果</span><br>
                    <span style="padding-left: 15px" class="say">情缘是上天精心编制的谎</span><br>
                    <span style="padding-left: 15px" class="say">我情愿尽心尽力的上这一次当</span><br>
                    <span style="padding-left: 15px" class="say">你啊</span><br>
                    <span style="padding-left: 15px" class="say">年少时的乖张</span><br>
                    <span style="padding-left: 15px" class="say">年老时的拐杖</span><br>
                    <span style="padding-left: 15px" class="say">我都想在场、都愿捧场</span><br>
                    <span style="padding-left: 15px" class="say">即使只是徒留美梦一场</span><br>
                    <span style="padding-left: 15px" class="say">也好过一生里空旷异常</span><br>


                    -->

                </font>
                </p>
            </div>
        </div>
        <div id="clock-box">
            <span class="STYLE1"></span>
            <div id="clock"></div>
        </div>
        <canvas id="canvas" width="1100" height="680"></canvas>
    </div>

</div>


<!--==========================================================-->
<script>
    (function () {
        var canvas = $('#canvas');
        if (!canvas[0].getContext) {
            $("#error").show();
            return false;
        }

        var width = canvas.width();
        var height = canvas.height();
        canvas.attr("width", width);
        canvas.attr("height", height);
        var opts = {
            seed: {
                x: width / 2 - 20,
                color: "rgb(190, 26, 37)",
                scale: 2
            },
            branch: [
                [535, 680, 570, 250, 500, 200, 30, 100, [
                    [540, 500, 455, 417, 340, 400, 13, 100, [
                        [450, 435, 434, 430, 394, 395, 2, 40]
                    ]],
                    [550, 445, 600, 356, 680, 345, 12, 100, [
                        [578, 400, 648, 409, 661, 426, 3, 80]
                    ]],
                    [539, 281, 537, 248, 534, 217, 3, 40],
                    [546, 397, 413, 247, 328, 244, 9, 80, [
                        [427, 286, 383, 253, 371, 205, 2, 40],
                        [498, 345, 435, 315, 395, 330, 4, 60]
                    ]],
                    [546, 357, 608, 252, 678, 221, 6, 100, [
                        [590, 293, 646, 277, 648, 271, 2, 80]
                    ]]
                ]]
            ],
            bloom: {
                num: 700,
                width: 1080,
                height: 650,
            },
            footer: {
                width: 1200,
                height: 5,
                speed: 10,
            }
        }

        var tree = new Tree(canvas[0], width, height, opts);
        var seed = tree.seed;
        var foot = tree.footer;
        var hold = 1;

        canvas.click(function (e) {
            var offset = canvas.offset(), x, y;
            x = e.pageX - offset.left;
            y = e.pageY - offset.top;
            if (seed.hover(x, y)) {
                hold = 0;
                canvas.unbind("click");
                canvas.unbind("mousemove");
                canvas.removeClass('hand');
            }
        }).mousemove(function (e) {
            var offset = canvas.offset(), x, y;
            x = e.pageX - offset.left;
            y = e.pageY - offset.top;
            canvas.toggleClass('hand', seed.hover(x, y));
        });

        var seedAnimate = eval(Jscex.compile("async", function () {
            seed.draw();
            while (hold) {
                $await(Jscex.Async.sleep(10));
            }
            while (seed.canScale()) {
                seed.scale(0.95);
                $await(Jscex.Async.sleep(10));
            }
            while (seed.canMove()) {
                seed.move(0, 2);
                foot.draw();
                $await(Jscex.Async.sleep(10));
            }
        }));

        var growAnimate = eval(Jscex.compile("async", function () {
            do {
                tree.grow();
                $await(Jscex.Async.sleep(10));
            } while (tree.canGrow());
        }));

        var flowAnimate = eval(Jscex.compile("async", function () {
            do {
                tree.flower(2);
                $await(Jscex.Async.sleep(10));
            } while (tree.canFlower());
        }));

        var moveAnimate = eval(Jscex.compile("async", function () {
            tree.snapshot("p1", 240, 0, 610, 680);
            while (tree.move("p1", 500, 0)) {
                foot.draw();
                $await(Jscex.Async.sleep(10));
            }
            foot.draw();
            tree.snapshot("p2", 500, 0, 610, 680);

            // 会有闪烁不得意这样做
            canvas.parent().css("background", "url(" + tree.toDataURL('image/png') + ")");
            canvas.css("background", "#ffe");
            $await(Jscex.Async.sleep(300));
            canvas.css("background", "none");
        }));

        var jumpAnimate = eval(Jscex.compile("async", function () {
            var ctx = tree.ctx;
            while (true) {
                tree.ctx.clearRect(0, 0, width, height);
                tree.jump();
                foot.draw();
                $await(Jscex.Async.sleep(25));
            }
        }));

        var textAnimate = eval(Jscex.compile("async", function () {
            var together = new Date();
            together.setFullYear(2010, 1, 15); 			//时间年月日
            together.setHours(16);						//小时
            together.setMinutes(53);					//分钟
            together.setSeconds(0);					//秒前一位
            together.setMilliseconds(2);				//秒第二位

            $("#code").show().typewriter();
            $("#clock-box").fadeIn(500);
            while (true) {
                timeElapse(together);
                $await(Jscex.Async.sleep(1000));
            }
        }));

        var runAsync = eval(Jscex.compile("async", function () {
            $await(seedAnimate());
            $await(growAnimate());
            $await(flowAnimate());
            $await(moveAnimate());

            textAnimate().start();

            $await(jumpAnimate());
        }));

        runAsync().start();
    })();

</script>


</body>
</html>